package genericity_try;

public interface GenericInterface<T> {
    void display(T value);
}

class GenericInterfaceTest<T> implements GenericInterface<T>{
    T info;
    GenericInterfaceTest(T a){
        info = a;
    }

    public T getInfo() {
        return info;
    }

    @Override
    public void display(T value) {
        System.out.println(value);
    }

    public static void main(String[] args) {
        GenericInterfaceTest<String> t1 = new GenericInterfaceTest<>("benbendao");
        GenericInterface<Integer> t2 = new GenericInterfaceTest<>(22);//只能调用接口里面的方法，不能调用实现类里面的

        System.out.println(t1.info);
        t1.display("handsome boy");
        t2.display(123);
    }
}

